<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = 'animalscolor';	//語言檔參數，務必放在最前面
$intLID = empty($_data["LottoID"])?1:(int)$_data["LottoID"];
$intSid = $_data[sid];

include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/todaygame/Gamble". $intLID .".inc.php");
include_once(__Common_Path. '/gambletype/GambleType'. $_SESSION["Member_Info"] -> GambleType. '_'. $intLID. '.inc.php');
include_once(__Common_Path."/betparam/AnimalsParams_". $intLID .".inc.php");


//取得 TodayGame 資料 色波 BetType = 17 , 生肖 BetType = 18
$arrBT = array(17 => array(0, 1, 2), 18=> array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
foreach($arrBT as $intBT => $arrNum) {
	include_once(__Common_Path."/todaygame/TodayGame". $intLID ."_". $intBT .".inc.php");
}

$isStop = false;
if (!is_array($_arrTodayGame) || !is_array($_arrGamble)) {
	$isStop = true;
} else {
	list($intGID, $arrGData) = each($_arrGamble);

	//判斷是否有 Game 時間是否過期
	$GameEndDateTime	= $arrGData["GameDate"] .' '. $arrGData["EndGameTime"];
	$NowDateTime		= date("Y-m-d") .' '. date("H:i:s");

	if ($NowDateTime > $GameEndDateTime) {
		$isStop = true;
	} else {
		$isStop = false;
	}
}

$fp = @file(__Membertemplate_Path."/animalscolor.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

$fp = str_replace("{SerialNo}", ($isStop)?"0":$arrGData["SerialNo"], $fp);
$fp = str_replace("{ShowGameDate}", $arrGData["GameDate"], $fp);
$fp = str_replace("{ShowGameTime}", $arrGData["GameTime"], $fp);
$fp = str_replace("{LottoID}", $intLID, $fp);
$fp = str_replace("{GambleID}", $intGID, $fp);
$fp = str_replace("{UserID}", $_SESSION["Member_Info"] -> ID, $fp);
$fp = str_replace("{sid}", $_data["sid"], $fp);
$arrCheckKey = explode(" ", microtime());
$fp = str_replace("{CheckKeyValue1}", $arrCheckKey[0], $fp);
$fp = str_replace("{CheckKeyValue2}", $arrCheckKey[1], $fp);

foreach($arrBT as $intBT => $arrNum) {

	foreach($arrNum as $intNum){
		$intApointNum = (int)$_arrGLineNumToApointNum[$intLID][18][$intNum];
		$flGLine = $_arrGambleType[$intBT][$intApointNum];
		$arrTGame = $_arrTodayGame[$intGID][$intBT][$intNum];

		if($arrTGame["isStopBet"] || $isStop){
			$fp = str_replace("{Odds".$intBT."-".$intNum."}", '<b>'.$_strAnimalsColor["isStopBet"].'</b>', $fp);
		}else{
			$strLink = '<a target="leftFrame" href="wager_common.php?UserID='. $_SESSION["Member_Info"] -> ID .'&GambleID='. $intGID .'&Bet_Type='.$intBT.'&OddsID='. $arrTGame["OddsID"] .'&Odds='. ($arrTGame["Odds"] + $flGLine) .'&LottoID='. $intLID .'&Number='. $intNum .'&sid='.$intSid.'">'. ($arrTGame["Odds"] + $flGLine) .'</a>';

			$strLink .= '<br /><input name="Odds'.$intBT.'_'.$intNum.'" value="" type="text" class="zamoney"  onkeypress="return CheckNumKey()" oddsid="'.$arrTGame["OddsID"].'">';
			$fp = str_replace("{Odds".$intBT."-".$intNum."}", $strLink, $fp);
		}
	}
}

foreach($_arrAnimals as $intNum => $strAnumals){
	$fp = str_replace("{AParams".$intNum."}", $_arrAnimalsParams[$intNum], $fp);
}


//以下位置不可上下移動
while(list($k, $v) = each($_strAnimalsColor)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>